<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="$!webPath/css/template.css"  rel="stylesheet" type="text/css">
    <link href="$!webPath/css/jquery-ui-1.8.22.custom.css" type=text/css rel=stylesheet>
    <script src="$!webPath/js/jquery.min.js"></script>
    <script src="$!webPath/js/jquery-1.6.2.js"></script>
    <script src="$!webPath/js/jquery-ui-1.8.21.js"></script>
</head>
<body>
<div class="header_nav">
    <iframe name="content_frame" src="$!webPath/admin/nav" marginwidth=0 marginheight=0  frameborder=0 width=100% height=80/></iframe>
    <div class="cont_right"><a href="$!webPath/login">注销</a></div>
</div>
<div class="cont">
    <h3 class="seth">战队管理</h3>
    <div class="nav_list">
        <ul>
            <li><a href="$!webPath/admin/teamList?size=10&page=0" class="this"><b>战队列表</b></a></li>
        </ul>
    </div>
    <form action="$!webPath/admin/" method="post" id="ListForm" >
        <div class="fshoptb">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="fshop_table">
                <tr>
                    <th width="10%">位置</th>
                    <th width="5%" align="center">战队名称</th>
                    <th width="10%" align="center">队长名称</th>
                    <th width="20%" align="center">创建时间</th>
                    <th width="20%" align="center">战队类型</th>
                    <th width="10%" align="center">是否锁定</th>
                    <th width="10%" align="center">更新人</th>
                    <th align="center">操作</th>
                </tr>
                <tbody id="teams_table">
                #foreach($obj in $!teams)
                <tr>
                    <td align="center">$!obj.location</td>
                    <td align="center">$!obj.name</td>
                    <td align="center">$!obj.leaderName</td>
                    <td align="center">$!obj.createdAt</td>
                    #if($!obj.teamStatus==0)
                    <td align="center">未激活</td>
                    #elseif($!obj.teamStatus==1)
                    <td align="center">普通战队</td>
                    #elseif($!obj.teamStatus==2)
                    <td align="center">职业战队</td>
                    #elseif($!obj.teamStatus==3)
                    <td align="center">待审核</td>
                    #end
                    #if($!obj.isLocked==0)
                    <td align="center">未锁定</td>
                    #elseif($!obj.isLocked==1)
                    <td align="center">锁定</td>
                    #end
                    <td align="center">$!obj.updateBy</td>
                    <td align="center" class="hui oprate_con">
                        <a href="$!webPath/admin/review_team?teamId=$!obj.id" class="blue">编辑</a>
                        <a href="$!webPath/admin/modifiedTeamScore?teamId=$!obj.id" class="blue">修改积分</a>
                    </td>
                </tr>
                #end
                </tbody>
            </table>
            <span id="spanFirst">第一页</span> <span id="spanPre">上一页</span> <span id="spanNext">下一页</span>
        </div>
        <div class="operate_bar">
            <div class="fenye">
                $!gotoPageFormHTML
            </div>
        </div>
    </form>
</div>
<script>
    getUrlParam = function (name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
    var pageSize = getUrlParam('size');
    var page = parseInt(getUrlParam('page'));

    //替换指定传入参数的值,paramName为参数,replaceWith为新值
    function replaceParamVal(paramName,replaceWith) {
        var oUrl = this.location.href.toString();
        var re=eval('/('+ paramName+'=)([^&]*)/gi');
        var nUrl = oUrl.replace(re,paramName+'='+replaceWith);
        this.location = nUrl;
    }

    $('#spanFirst').click(function () {
        page=0
        $.ajax({
            url:'$!webPath/admin/teamList?size=10&page='+page,
            success:function(data){
                console.log(data);
                window.location.href='$!webPath/admin/teamList?size=10&page='+page;
                replaceParamVal('page',page);

            }
        })
    })
    $('#spanNext').click(function(){
        page++;

        $.ajax({
            url:'$!webPath/admin/teamList?size=10&page='+page,
            success:function(data){

                console.log(page);
                console.log(data);
                window.location.href='$!webPath/admin/teamList?size=10&page='+page;
                replaceParamVal('page',page);

            }
        })
    })

    $('#spanPre').click(function(){
        //location.reload()
        page--;
        if(page<=0){
            page=0;
        }
        $.ajax({
            url:'$!webPath/admin/teamList?size=10&page='+page,
            success:function(data){
                console.log(data);
                window.location.href='$!webPath/admin/teamList?size=10&page='+page;
                replaceParamVal('page',page);

            }
        })
    })
</script>
</body>
</html>
